import { getAreaObj, regularRule, uploadType } from '@/utils/util'
import { toSearchHandle, configToSearch, configToReserveSearch } from '@/views/datacenter/basicData/utils/index'
import apiMod from '@/apiMod'

export const BaseFormConfig = {
	prop: 'dp_service_object',
	inline: false,
	showBtn: false,
	labelPosition: 'top',
	column: [
		{
			label: '照片',
			tip: '',
			prop: 'image',
			type: 'upload',
			labelPosition: 'top',
			showFileList: false,
			limit: 1,
			multiple: false,
			viewDisplay: false,
			span: 24,
		},
		{
			label: '姓名',
			prop: 'name',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			viewDisplay: false,
			changeField: true,
			rules: [{ required: true, message: '请输入姓名' }],
			span: 8,
		},
		{
			label: '户籍地区',
			prop: 'crAreas',
			propName: 'cr_areas',
			type: 'AplidAreaSelect',
			changeField: true,
			rules: [{ required: true, message: '请选择户籍地区' }],
			span: 8,
		},
		{
			label: '户籍地址',
			prop: 'crAddress',
			maxlength: '140',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			rules: [{ required: true, message: '请输入户籍地址' }],
			span: 8,
		},
		{
			label: '户籍类型',
			prop: 'crType',
			propName: 'crTypeLabel',
			type: 'remoteSelect',
			code: 'REG_RESIDENCE_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			changeField: true,
			span: 8,
			rules: [{ required: true, message: '请输入户籍类型' }],
		},
		{
			label: '户籍与现居地址一致',
			prop: 'isSameAdress',
			propName: 'isSameAdressLabel',
			type: 'select',
			dicData: [
				{ label: '否', value: 0 },
				{ label: '是', value: 1 },
			],
			changeField: true,
			span: 8,
		},
		{
			label: '户籍地邮政编码',
			prop: 'crPostalCode',
			maxlength: '6',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '是否使用智能手机',
			prop: 'whetherPhone',
			propName: 'whetherPhoneLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			control: (e, model) => {
				return {
					telephone: {
						display: e == 1,
					},
				}
			},
			span: 8,
		},
		{
			label: '证件类型',
			prop: 'cardType',
			propName: 'cardTypeLabel',
			type: 'remoteSelect',
			code: 'ID_CARD_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
			changeField: true,
			rules: [{ required: true, message: '请选择证件类型' }],
		},
		{
			label: '证件号码',
			prop: 'idCard',
			type: 'input',
			editDisabled: true,
			span: 8,
			changeField: true,
			rules: [{ required: true, message: '请输入证件号码' }],
			change: (item, form) => {
				if (form.idCard) form.idCard = form.idCard.toUpperCase()
			},
		},

		{
			label: '联系方式',
			prop: 'telephone',
			type: 'input',
			viewDisplay: false,
			span: 8,
			changeField: true,
			change: (item, form) => {
				if (item == form.contactPhone) {
					ElMessage.warning('联系人电话不能和老人电话一样!')
				}
			},
			rules: [{ pattern: regularRule.phone, message: '请输入正确的联系电话' }],
		},
		{
			label: '家庭固话',
			prop: 'phone',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			changeField: true,
			span: 8,
		},
		{
			label: '现居地区',
			prop: 'areas',
			propName: 'areas_name',
			type: 'AplidAreaSelect',
			changeField: true,
			rules: [{ required: true, message: '请选择现居地区' }],
			span: 8,
		},
		{
			label: '现居地址',
			prop: 'address',
			maxlength: '140',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			rules: [{ required: true, message: '请输入现居地址' }],
			span: 8,
		},
		{
			label: '生存状态',
			prop: 'existence',
			propName: 'existenceLabel',
			type: 'remoteSelect',
			code: 'EXISTENCE_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			changeField: true,
			span: 8,
			rules: [{ required: true, message: '请选择生存状态' }],
		},
		{
			label: '去世时间',
			prop: 'deadTime',
			type: 'date',
			changeField: true,
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
		},

		{
			label: '是否为探访老人',
			prop: 'isVisitorElderly',
			propName: 'isVisitorElderlyLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请选择是否为探访老人' }],
			control: (e, model) => {
				return {
					visitorElderlyType: {
						display: e == 1,
					},
				}
			},
		},
		{
			label: '老人类别（探访对象）',
			prop: 'visitorElderlyType',
			propName: 'visitorElderlyTypeLabel',
			type: 'remoteSelect',
			code: 'VISITOR_ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			changeField: true,
			span: 8,
		},
		{
			label: '老人类别(区探访对象)',
			prop: 'areaElderlyType',
			propName: 'areaElderlyTypeLabel',
			type: 'remoteSelect',
			code: 'AREA_ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '老人类别（政府兜底保障对象）',
			prop: 'elderlyType',
			propName: 'elderlyTypeLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: true,
			changeField: true,
			rules: [{ required: true, message: '请选择老人类别' }],
			span: 16,
		},
		{
			label: '居住情况',
			prop: 'residence',
			propName: 'residenceLabel',
			type: 'remoteSelect',
			code: 'LIVE_SITUATE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			changeField: true,
			span: 8,
		},
		{
			label: '常住时间',
			prop: 'liveTime',
			propName: 'liveTimeLabel',
			code: 'LIVE_TIME',
			type: 'remoteSelect',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '存在监护人（联系人）',
			prop: 'isWithGuardian',
			propName: 'isWithGuardianLabel',
			type: 'select',
			dicData: [
				{ label: '否', value: 0 },
				{ label: '是', value: 1 },
			],
			span: 8,
		},
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '联系人信息',
			span: 24,
		},
		{
			label: '联系人姓名',
			prop: 'contactName',
			type: 'input',
			span: 8,
			rules: [{ required: true, message: '请输入联系人姓名' }],
		},
		{
			label: '联系人电话 ',
			prop: 'contactPhone',
			type: 'input',
			span: 8,
			rules: [{ required: true, message: '请输入联系人电话 ' }],
			change: (item, form) => {
				if (item == form.telephone) {
					ElMessage.warning('联系人电话不能和老人电话一样!')
				}
			},
		},
		{
			label: '与联系人关系 ',
			prop: 'contactRelationship',
			type: 'input',
			span: 8,
			rules: [{ required: true, message: '请输入与联系人关系 ' }],
		},
		//------------养老需求-------------
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '养老需求',
			span: 24,
		},
		{
			label: '养老需求',
			prop: 'elderlyCareDemand',
			propName: 'elderlyCareDemandLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_DEMAND',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: true,
			labelPosition: 'top',
			span: 8,
		},
		{
			label: '其他需求',
			prop: 'elderlyCareOther',
			maxlength: '140',
			showWordLimit: true,
			type: 'text',
			labelPosition: 'top',
			span: 16,
		},
		{
			label: '协议到期时间',
			prop: 'homeAgreementDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			changeField: true,
			span: 8,
		},
		{
			label: '服务协议',
			prop: 'homeAgreement',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
			changeField: true,
			span: 16,
		},

		//------------残疾状况-------------
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '残疾状况',
			span: 24,
		},
		{
			label: '是否残疾',
			prop: 'isDisability',
			propName: 'isDisabilityLabel',
			rules: [{ required: true, message: '请选择是否残疾' }],
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			control: (e, model) => {
				return {
					disabilityType: {
						display: e == 1,
					},
					disabilityClass: {
						display: e == 1,
					},
					disabilityCertificateId: {
						display: e == 1,
					},
					disabilityPhone: {
						display: e == 1,
					},
					disabilityDate: {
						display: e == 1,
					},
					disabilityPhoto: {
						display: e == 1,
					},
				}
			},
			span: 8,
		},
		{
			label: '残疾类型',
			prop: 'disabilityType',
			propName: 'disabilityTypeLabel',
			type: 'remoteSelect',
			code: 'DISABILITY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '残疾等级',
			prop: 'disabilityClass',
			propName: 'disabilityClassLabel',
			type: 'remoteSelect',
			code: 'DISABILITY_CLASS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '残疾证',
			prop: 'disabilityPhoto',
			type: 'upload',
			labelPosition: 'top',
			showFileList: false,
			limit: 1,
			multiple: false,
			span: 12,
		},
		{
			label: '残疾证到期时间',
			prop: 'disabilityDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 12,
		},
		//------------能力等级-------------
		{
			type: 'DividerHtml',
			modelValue: '能力等级',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '是否完成能力等级评估',
			prop: 'isLevel',
			propName: 'isLevelLabel',
			changeField: true,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 24,
		},
		{
			label: '能力评估等级（国标）',
			prop: 'countryLevel',
			propName: 'countryLevelLabel',
			type: 'remoteSelect',
			code: 'ACCESS_LEVEL_COUNTRY',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 8,
		},
		{
			label: '能力评估等级（国标）评估时间',
			prop: 'countryEvaluationTime',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			changeField: true,
			span: 8,
		},
		{
			label: '能力评估等级（国标）评估单位',
			prop: 'countryLevelUnit',
			maxlength: '50',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			span: 8,
		},

		{
			label: '能力评估等级（市标）',
			prop: 'cityLevel',
			propName: 'cityLevelLabel',
			type: 'remoteSelect',
			code: 'ACCESS_LEVEL_CITY',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 8,
		},
		{
			label: '能力评估等级（市标）评估时间',
			prop: 'cityEvaluationTime',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			changeField: true,
			span: 8,
		},
		{
			label: '能力评估等级（市标）评估单位',
			prop: 'cityLevelUnit',
			maxlength: '50',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			span: 8,
		},
	],
}

export const ExtendFormConfig = {
	prop: 'dp_service_object_extend',
	inline: false,
	showBtn: false,
	labelPosition: 'top',
	column: [
		{
			label: '是否失智',
			prop: 'isLossWisdom',
			propName: 'isLossWisdomLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 8,
		},
		{
			label: '是否留守',
			prop: 'isStayBehind',
			propName: 'isStayBehindLabel',
			rules: [{ required: true, message: '请选择是否留守' }],
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 8,
		},
		{
			label: '是否孤老',
			prop: 'isLonelyOld',
			propName: 'isLonelyOldLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			rules: [{ required: true, message: '请选择是否孤老' }],
			span: 8,
		},

		{
			label: '政治面貌',
			prop: 'politicalStatus',
			propName: 'politicalStatusLabel',
			type: 'remoteSelect',
			code: 'POLITICAL_STATUS',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '享受保障待遇',
			prop: 'enjoyTreatment',
			propName: 'enjoyTreatmentLabel',
			type: 'remoteSelect',
			code: 'ENJOY_TREATMENT',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '退休类别',
			prop: 'retireType',
			propName: 'retireTypeLabel',
			type: 'remoteSelect',
			code: 'RETIRE_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '离退休前单位工作性质',
			prop: 'retireWork',
			propName: 'retireWorkLabel',
			type: 'remoteSelect',
			code: 'RETIRE_WORK',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '文化程度',
			prop: 'educationDegree',
			propName: 'educationDegreeLabel',
			type: 'remoteSelect',
			code: 'EDUCATION_DEGREE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请选择文化程度' }],
		},
		{
			label: '宗教信仰',
			prop: 'religiousBelief',
			propName: 'religiousBeliefLabel',
			type: 'remoteSelect',
			code: 'RELIGIOUS_BELIEF',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},

		{
			label: '医疗保障',
			prop: 'medicalSecurity',
			propName: 'medicalSecurityLabel',
			type: 'remoteSelect',
			code: 'MEDICAL_SECURITY',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '优待证编号',
			prop: 'preferenceCard',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '原照料情况',
			prop: 'careSituation',
			propName: 'careSituationLabel',
			type: 'remoteSelect',
			code: 'CARE_SITUATION',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '社会活动情况',
			prop: 'socialActivitiesSituation',
			propName: 'socialActivitiesSituationLabel',
			type: 'remoteSelect',
			code: 'SOCIAL_ACTIVITIES_SITUATE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '社会活动类型',
			prop: 'socialActivitiesType',
			propName: 'socialActivitiesTypeLabel',
			type: 'remoteSelect',
			code: 'SOCIAL_ACTIVITIES_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '特长',
			prop: 'specialty',
			propName: 'specialtyLabel',
			type: 'remoteSelect',
			code: 'SPECIALTY',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		//--------------------社保信息 ----------------
		{
			type: 'DividerHtml',
			modelValue: '社保信息',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '是否参加社保',
			prop: 'isSocialSecurity',
			propName: 'isSocialSecurityLabel',
			rules: [{ required: true, message: '请选择是否参加社保' }],
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 8,
		},
		{
			label: '社保卡号',
			prop: 'socialCard',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '社会保障',
			prop: 'socialSecurity',
			propName: 'socialSecurityLabel',
			type: 'remoteSelect',
			code: 'SOCIAL_SECURITY',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		//--------------------银行账户信息 ----------------
		{
			type: 'DividerHtml',
			modelValue: '银行账户信息',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '开户网点名称',
			prop: 'accountName',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '开户银行',
			prop: 'depositBank',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '银行卡号/存折号',
			prop: 'bankAccount',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '子女数量',
			prop: 'childrenNumber',
			isNum: true,
			type: 'input',
			span: 8,
		},
		{
			label: '是否独生子女家庭',
			prop: 'isOneChild',
			propName: 'isOneChildLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 8,
		},
		//--------------------资料信息 ----------------
		{
			type: 'DividerHtml',
			modelValue: '资料信息',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '',
			type: 'dynamic',
			prop: 'dp_service_object_material',
			span: 24,
			column: [
				{
					label: '资料类型',
					prop: 'dataType',
					propName: 'dataTypeLabel',
					type: 'remoteSelect',
					code: 'MATERIAL_DATA_TYPE',
					api: 'getDictItemList',
					filterKey: 'value',
					multiple: false,
					showLabel: false,
					rules: [{ required: true, message: '请选择资料类型' }],
				},
				{
					label: '到期时间',
					prop: 'endTime',
					type: 'date',
					format: 'YYYY年MM月DD日',
					valueFormat: 'YYYY-MM-DD',
					span: 12,
					showLabel: false,
				},
				{
					label: '资料图片',
					prop: 'material',
					type: 'upload',
					custome: 'file',
					fileType: uploadType.fileMetaType,
					listType: 'text',
					labelPosition: 'top',
					showFileList: true,
					limit: 4,
					multiple: true,
					span: 24,
					showLabel: false,
				},
			],
		},
		//--------------------联系人信息 ----------------
		{
			type: 'DividerHtml',
			modelValue: '联系人信息（至少添加一人）',
			prop: 'contactHtml',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '',
			type: 'dynamic',
			prop: 'dp_service_object_contact',
			span: 24,
			changeField: true,
			column: [
				{
					label: '姓名',
					prop: 'contactName',
					maxlength: '20',
					showWordLimit: true,
					type: 'text',
					showLabel: false,
					span: 8,
				},
				{
					label: '联系方式',
					prop: 'contactTelephone',
					maxlength: '11',
					showWordLimit: true,
					type: 'text',
					showLabel: false,
					span: 8,
				},
				{
					label: '和老人关系',
					prop: 'elderlyRelationshipLabel',
					type: 'text',
					// prop: 'elderlyRelationship',
					// propName: 'elderlyRelationshipLabel',
					// type: 'remoteSelect',
					// code: 'ELDERLY_RELATIONSHIP',
					// api: 'getDictItemList',
					// filterKey: 'value',
					// multiple: false,
					// showLabel: false,
					placeholder: '如大儿子、二女儿',
					span: 8,
				},
				{
					label: '证件号码',
					prop: 'contactCardId',
					showWordLimit: true,
					type: 'text',
					showLabel: false,
					span: 8,
				},
				{
					label: '现居地区',
					prop: 'contactAreas',
					propName: 'contact_areas_name',
					type: 'AplidAreaSelect',
					span: 8,
					showLabel: false,
				},
			],
		},
	],
}
export const OtherFormConfig = {
	prop: 'dp_service_object_other',
	inline: false,
	showBtn: false,
	labelPosition: 'top',
	column: [
		//--------------------经济状况 ----------------
		{
			type: 'DividerHtml',
			modelValue: '经济状况',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '经济状况',
			prop: 'economicSituation',
			propName: 'economicSituationLabel',
			type: 'remoteSelect',
			code: 'ECONOMIC_SITUATION',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '年度可支配收入',
			prop: 'disposableIncome',
			propName: 'disposableIncomeLabel',
			type: 'remoteSelect',
			code: 'DISPOSABLE_INCOME',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '收入来源',
			prop: 'incomeSource',
			propName: 'incomeSourceLabel',
			type: 'remoteSelect',
			code: 'INCOME_SOURCE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},

		{
			label: '个人年收入',
			prop: 'annualSalary',
			type: 'input',
			isNum: true,
			append: '（元）',
			rules: [{ validator: regularRule.number, message: '请输入正确的数量' }],
			span: 8,
		},
		{
			label: '家庭年收入',
			prop: 'familySalary',
			type: 'input',
			isNum: true,
			append: '（元）',
			rules: [{ validator: regularRule.number, message: '请输入正确的数量' }],
			span: 8,
		},

		{
			label: '经济困难证明',
			prop: 'economicHardship',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
			span: 8,
		},
		//--------------------居住条件 ----------------
		{
			type: 'DividerHtml',
			modelValue: '居住条件',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '住房性质',
			prop: 'housingProperty',
			propName: 'housingPropertyLabel',
			code: 'HOUSEING_PROPERTY',
			type: 'remoteSelect',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '居室',
			prop: 'liveRoom',
			propName: 'liveRoomLabel',
			type: 'remoteSelect',
			code: 'LIVE_ROOM',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '是否有出入无障碍设施',
			prop: 'isAccessibility',
			propName: 'isAccessibilityLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否有楼层电梯',
			prop: 'isElevator',
			propName: 'isElevatorLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '居住楼层（楼层无电梯的）',
			prop: 'liveFloor',
			propName: 'liveFloorLabel',
			type: 'remoteSelect',
			code: 'LIVE_FLOOR',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '是否有室内厕所',
			prop: 'isToilet',
			propName: 'isToiletLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否有室内洗浴设备',
			prop: 'isBathEquipment',
			propName: 'isBathEquipmentLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否有室内无障碍设施',
			prop: 'isIndoorAccessibility',
			propName: 'isIndoorAccessibilityLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否有室内洗浴设施',
			prop: 'isBathingFacilities',
			propName: 'isBathingFacilitiesLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否有居住安全风险',
			prop: 'isSafetyRisks',
			propName: 'isSafetyRisksLabel',
			span: 8,
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
		},
		{
			label: '是否完成适老化改造',
			prop: 'isRetrofit',
			propName: 'isRetrofitLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			span: 8,
		},
		//--------------------健康诊断内容 ----------------
		{
			type: 'DividerHtml',
			modelValue: '健康诊断内容',
			labelPosition: 'top',
			position: 'center',
			span: 24,
		},
		{
			label: '过敏物',
			prop: 'allergens',
			type: 'textarea',
			maxlength: '50',
			rows: 1,
			showWordLimit: true,
			span: 8,
		},
		{
			label: '用药内容',
			prop: 'medicationContent',
			type: 'textarea',
			maxlength: '140',
			rows: 1,
			showWordLimit: true,
			span: 8,
		},
		{
			label: '用药时间段',
			prop: 'dosingTime',
			type: 'textarea',
			maxlength: '140',
			rows: 1,
			showWordLimit: true,
			span: 8,
		},
		{
			label: '用药描述',
			prop: 'medicationDescription',
			type: 'textarea',
			maxlength: '140',
			rows: 1,
			showWordLimit: true,
			span: 8,
		},
		{
			label: '体征数据',
			prop: 'signsData',
			type: 'textarea',
			maxlength: '140',
			rows: 1,
			showWordLimit: true,
			span: 8,
		},
	],
}
export const rechangeConfig = {
	label: '变更材料',
	prop: 'dp_service_object_other',
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	submitBtnText: '确认并提交',
	backBtnText: '返回修改内容',
	column: [
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '变更内容',
			span: 24,
		},
		{
			prop: 'content',
			type: 'input',
			span: 24,
		},
		{
			type: 'DividerHtml',
			labelPosition: 'top',
			position: 'center',
			modelValue: '变更材料',
			span: 24,
		},
		{
			label: '情况说明',
			prop: 'changeDescription',
			type: 'textarea',
			maxlength: '140',
			rows: 2,
			showWordLimit: true,
			span: 24,
		},
		{
			label: '证明材料',
			prop: 'changeMaterials',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
			span: 24,
		},
	],
}
const reserveSearchConfig: any = {
	inline: true,
	showBtn: false,
	labelPosition: 'left',
	column: [...configToReserveSearch(BaseFormConfig.column)],
}
const moreSearchConfig: any = {
	inline: true,
	showBtn: false,
	labelPosition: 'left',
	column: [...configToSearch(BaseFormConfig.column)],
}

export const detailConfig = {
	customeHeader: {
		integrityConfig: {
			baseTableName: 'dp_service_object_home',
			materialTableName: 'dp_service_object_material',
			soleValue: 'idCard',
		},
		type: 'CardTwo',
		title: 'name',
		avatar: 'image',
		tipList: [{ prop: 'telephone', type: 'tip-success', label: '联系电话' }],
		tagList: [
			{
				prop: 'countryLevel',
				propName: 'countryLevelLabel',
				code: 'ACCESS_LEVEL_COUNTRY',
				custome: 'tag',
				type: 'success',
				label: '能力等级',
			},
			{ prop: 'birthday', type: 'success', label: '公历' },
			{ prop: 'lunarBirthday', type: 'success', label: '农历' },
		],
		menuBtn: [
			{
				icon: 'delete',
				label: '删除服务对象',
				type: 'danger',
				operate: 'delete',
				auth: 'view_dpServiceObjectHome_del',
				hide: 'dataStatus==0',
				text: false,
				show: true,
				plain: true,
			},
		],
	},
}

export const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '服务对象', prop: 'oldman', width: 220, custome: 'UserCard', align: 'left' },
		{ label: '户籍地区', prop: 'tableCrAreaName', width: 220 },
		{ label: '现居地区', prop: 'tableAreaName' },
		{
			label: '老人类别（政府兜底保障对象）',
			prop: 'elderlyType',
			custome: 'dict',
			width: 220,
			code: 'ELDERLY_TYPE',
		},
		{
			label: '居住情况',
			prop: 'residence',
			custome: 'dict',
			code: 'LIVE_SITUATE',
		},
		{ label: '入库时间', prop: 'createTime' },
		{ label: '数据来源', prop: 'abutmentDataSource', code: 'ABUTMENT_DATA_SOURCE' },
		{
			label: '上链状态',
			prop: 'onBlockchainFlag',
			api: 'geiDictItemList',
			type: 'remoteSelect',
			code: 'BLOCK_CHAIN_STATUS',
			tipProp: 'onBlockchainTime',
			tipLabel: '上链时间',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 200,
			fixed: 'right',
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	labelWidth: '98px',
	column: [
		{
			label: '证件号码',
			prop: 'idCard',
			type: 'input',
			span: 6,
		},
		{
			label: '户籍地区',
			prop: 'crAreas',
			checkStrictly: true,
			type: 'AplidAreaSelect',
			span: 12,
		},
		{
			label: '姓名',
			prop: 'name',
			type: 'input',
			span: 6,
		},
		{
			label: '联系方式',
			prop: 'telephone',
			type: 'input',
			span: 6,
		},
		{
			label: '服务对象类别',
			prop: 'elderlyType',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 6,
		},
		{
			label: '居住状态',
			prop: 'residence',
			type: 'remoteSelect',
			code: 'LIVE_SITUATE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 6,
		},
		{
			label: '现居地区',
			prop: 'areas',
			propName: 'address',
			checkStrictly: true,
			type: 'AplidAreaSelect',
			span: 6,
		},
		{
			label: '所在单位',
			prop: 'unitName',
			span: 6,
			type: 'input',
		},
	],
}
export const dictcodes = [
	'VISITOR_ELDERLY_TYPE',
	'CHILDREN_SITUATION',
	'HOUSEING_PROPERTY',
	'LIVE_FLOOR',
	'LIVE_ROOM',
	'LIVE_TIME',
	'ID_CARD_TYPE',
	'REG_RESIDENCE_TYPE',
	'EXISTENCE_STATUS',
	'ELDERLY_DEMAND',
	'DISABILITY_TYPE',
	'DISABILITY_CLASS',
	'ELDERLY_TYPE',
	'BLOOD_TYPE',
	'NATIONALITY',
	'MARITAL_STATUS',
	'NURSE_TYPE',
	'OLDMAN_ZODIAC',
	'POLITICAL_STATUS',
	'ENJOY_TREATMENT',
	'SOCIAL_SECURITY',
	'EDUCATION_DEGREE',
	'RETIRE_TYPE',
	'RETIRE_WORK',
	'MEDICAL_SECURITY',
	'CARE_SITUATION',
	'SOCIAL_ACTIVITIES_SITUATE',
	'SOCIAL_ACTIVITIES_TYPE',
	'SPECIALTY',
	'MATERIAL_DATA_TYPE',
	'ELDERLY_RELATIONSHIP',
	'ECONOMIC_SITUATION',
	'INCOME_SOURCE',
	'DISPOSABLE_INCOME',
	'ACCESS_LEVEL_COUNTRY',
	'ACCESS_LEVEL_CITY',
	'LIVE_SITUATE',
	'RELIGIOUS_BELIEF',
	'SENIOR_LIVING',
	'EVALUATION_STATUS',
	'BLOCK_CHAIN_STATUS',
	'COMMON_FLAG',
	'ABUTMENT_DATA_SOURCE',
]
export const baseConfig = {
	pageName: '服务对象管理',
	dictcodes: dictcodes,
	rowKey: 'id',
	addLabel: '采集数据',
	tipLabel: 'name',
	needPigeonhole: true, // 是否显示顶部关于归档的部分
	exportMqTopic: [
		{
			topic: '/ning/export/dpServiceObjectHome/',
			label: '基础数据',
			code: 1006,
			po: 'dpServiceObjectHomePO',
		},
		{
			topic: '/ning/export/dpServiceObjectExtend/',
			label: '扩展信息',
			code: 1003,
			po: 'dpServiceObjectExtendPO',
		},
		{
			topic: '/ning/export/dpServiceObjectContact/',
			label: '联系人信息',
			code: 1002,
			po: 'dpServiceObjectContactPO',
		},
		{
			topic: '/ning/export/dpServiceObjectOther/',
			label: '其他信息',
			code: 1005,
			po: 'dpServiceObjectOtherPO',
		},
		{
			topic: '/ning/export/dpServiceObjectMaterial/',
			label: '材料信息',
			code: 1004,
			po: 'dpServiceObjectMaterialPO',
		},
	],
	api: {
		moreSearch: 'view_search',
		reserveSearch: 'view_search                                       ',
		index: 'view_dpServiceObjectHome_page',
		count: 'view_dpServiceObjectHome_pageCount',
		add: 'view_dpServiceObjectHome_gather',
		edit: 'view_dpServiceObjectHome_edit',
		delete: 'view_dpServiceObjectHome_del',
		export: 'view_dpServiceObjectHome_exportAll',
	},
	auth: {
		index: 'view_dpServiceObjectHome_page',
		count: 'view_dpServiceObjectHome_pageCount',
		add: 'view_dpServiceObjectHome_gather',
		edit: 'view_dpServiceObjectHome_edit',
		delete: 'view_dpServiceObjectHome_del',
		export: 'view_dpServiceObjectHome_exportAll',
		detail: 'view_dpServiceObjectHomeAll_view',
		import: 'view_dpServiceObjectHome_import',
		mulitSet: 'mulitSet',
	},
	menuBtn: [
		{
			icon: 'editor',
			label: '查看档案',
			type: 'primary',
			operate: 'Archives',
			auth: 'view_dpServiceObjectHomeAll_view',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '65%',
		// fullscreen: true
	},

	searchConfig: {
		inline: true,
		showBtn: true,
		labelPosition: 'right',
		labelWidth: '100px',
		column: [
			{
				label: '证件号码',
				prop: 'idCard',
				type: 'input',
				span: 8,
			},
			{
				label: '户籍地区',
				prop: 'crAreas',
				checkStrictly: true,
				type: 'AplidAreaSelect',
				span: 8,
			},
			{
				label: '姓名',
				prop: 'name',
				type: 'input',
				span: 8,
			},
			{
				label: '联系方式',
				prop: 'telephone',
				type: 'input',
				span: 8,
			},
			{
				label: '服务对象类别',
				prop: 'elderlyType',
				type: 'remoteSelect',
				code: 'ELDERLY_TYPE',
				api: 'getDictItemList',
				filterKey: 'value',
				teleported: false,
				multiple: false,
				span: 8,
			},
			{
				label: '现居地区',
				prop: 'areas',
				checkStrictly: true,
				type: 'AplidAreaSelect',
				span: 8,
			},
		],
	},
	formConfig: {
		...OtherFormConfig,
		showBtn: true,
	},
	detailConfig,
	moreSearchConfig,
	// reserveSearchConfig,
	tableConfig,
	beforeOnLoadFormate: async (params) => {
		params = toSearchHandle(moreSearchConfig, reserveSearchConfig, params)
		const areasObj: any = getAreaObj(params.areas, '')
		const crAreasObj: any = getAreaObj(params.crAreas, 'cr')
		const queryObj = {
			...params,
			...areasObj,
			...crAreasObj,
			areas: undefined,
			crAreas: undefined,
			buildInfo: undefined,
			buildInfoName: undefined,
		}
		return Promise.resolve({
			...queryObj,
		})
	},
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			const crAreaName = getAreaObj(item, 'cr')
			const areas_name = getAreaObj(item, '')
			return {
				...item,
				areas_name,
				crAreaName,
				tableAreaName: [item.areaName, item.streetName, item.communityName].filter(Boolean).join(''),
				tableCrAreaName: [item.crAreaName, item.crStreetName, item.crCommunityName].filter(Boolean).join(''),
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
	operateFormate: async (form, type) => {
		return new Promise((resolve, reject) => {
			if (type == 'edit') {
				apiMod.view_dpServiceObjectOther_page({ idCard: form.idCard }).then((res) => {
					const data = res.data.records[0] || {}
					resolve({
						id: form.id,
						...data,
						idCard: form.idCard,
					})
				})
			} else {
				resolve(form)
			}
		})
	},
}
